package leecode

func CanJump(nums []int) bool {
	if len(nums) <= 1 {
		return true
	}
	var maxCover int
	for i := 0; i <= maxCover; i++ {
		cover := i + nums[i]
		if cover > maxCover {
			maxCover = cover
		}
		if maxCover > len(nums) {
			return true
		}
	}
	return false
}
